package cn.yangliu.nacos.consumer.feign;

import cn.yangliu.nacos.comm.JsonResult;
import cn.yangliu.nacos.consumer.feign.hystrix.Oauth2ServiceFallback;
import cn.yangliu.nacos.consumer.model.UserModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * The type of nacos.
 *
 * @author 问道于盲
 * @date 2019-12-30
 */
@FeignClient(name = "oauth2", fallback = Oauth2ServiceFallback.class)
public interface Oauth2Service {

    /**
     * check_token
     *
     * @param token
     * @return
     */
    @PostMapping("/oauth/check_token")
    JsonResult<Oauth2ClientInfo> clientInfo(@RequestParam("token") String token);


    @GetMapping("/user/principal")
    JsonResult<UserModel> principal(@RequestHeader("Authorization")String author);
}
